package com.xxx.mining.ui.wallet.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xxx.mining.R;
import com.xxx.mining.model.http.bean.RecordWithdrawalBean;
import com.xxx.mining.model.utils.StringUtil;

import java.util.List;

public class WithdrawalRecordAdapter extends BaseQuickAdapter<RecordWithdrawalBean, BaseViewHolder> {

    public WithdrawalRecordAdapter(@Nullable List<RecordWithdrawalBean> data) {
        super(R.layout.item_record_withdrawal, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RecordWithdrawalBean item) {
        helper.setText(R.id.item_withdrawal_record_amount, "-" + item.getAmount())
                .setText(R.id.item_withdrawal_record_time, item.getCreateTime())
                .setText(R.id.item_withdrawal_record_address, StringUtil.getAddress(item.getAddress()));

        TextView textView = helper.getView(R.id.item_withdrawal_record_type);
        switch (item.getStatus()) {
            case 0:
                textView.setText("转账中");
                break;
            case 1:
                textView.setText("成功");
                break;
            case 2:
                textView.setText("失败");
                break;
            case 3:
                textView.setText("等待审核");
                break;
        }
    }
}
